[Top] [Prev] [Next] [Bottom] [Contents]

SaPutBlobFromFile

Inserts Blob data contained in a UNIX file, into a database table. (Sybase Only)

Synopsis

#include "WorkingDialog.h"
int SaPutBlobFromFile(int vendor,
					char *sv, 
					char *db,
					char *tab,
					char *col,
					int coltype,
					char *where,
					int chunksize,
					char *path);

Arguments

vendor
SGESYBASE is the only valid value.
sv
pointer to a string containing the destination server name
db
pointer to a string containing the destination database name
tab
pointer to a string containing the destination table name
col
pointer to a string containing the destination column name
coltype
SA_TEXT for text blobs or SA_BINARY for binary (image) blobs
where
pointer to a string containing a where clause that is guaranteed to return a unique row in a table when used with a select statement.
chunksize
number of bytes to insert in one trip to the database. -1 signifies to use the default size.
Note: Increasing this number could improve performance, however, memory limitations must be considered. Default is 100000 bytes.
path
a pointer to a string containing a UNIX path and filename which contains the blob data to be inserted into the database.

Return Values

0 Means success
-1 a NULL argument value was passed to SaPutBlobFromFile
-3 Path does not point to an existing file.
-4 The file is not a regular UNIX file.
-5 Malloc failed
-6 Could not open file
-7 Read failed
-8 Blob insertion failed

Description

SaPutBlobFromFile will insert data from a UNIX file and into a blob column of a single row in a given table.

To insert character-based blobs, use SA_TEXT as the coltype.

To insert binary blobs, use SA_BINARY as the coltype.

Example 1

/* Using the BLOB_ALL flag */
#include "WorkingDialog.h"
...
int status;
status = SaPutBlobFromFile( SGESYBASE,
				"CEZANNE",
				"pubs2",
				"blurbs",
				"copy",
				SA_TEXT,
				"where au_id = `192-748-2293'",
				-1,
				"/tmp/blurb1.txt");
if(status == 0)
	printf("Success!\n");
else
	printf("Failed inserting blob with status %d.\n",
							status);
...

See Also



[Top] [Prev] [Next] [Bottom] [Contents]

info@bluestone.com
Copyright © 1997, Bluestone. All rights reserved.